FROM ubuntu:22.04 AS builder 

RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse" > /etc/apt/sources.list && \
echo "deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse" >> /etc/apt/sources.list && \
apt-get update -y  && \
apt-get install -y git && \ 
git clone -b main https://gitcode.com/hq_make/util-docker.git main && \ 
cd main/shell && chmod +x *.sh && \ 
./install.sh && cd ../ && rm -rf main && \ 
util-docker -cmd build_nginx -prefix /usr/local && \ 
util-docker -cmd build_start_proxy -prefix /usr/local && \
util-docker -cmd output_app -prefix /opt/myapp -apppath /usr/local/bin/start && \ 
util-docker -cmd output_app -prefix /opt/myapp -apppath /usr/local/bin/util-docker && \ 
util-docker -cmd output_app -prefix /opt/myapp -apppath /usr/local/bin/frpc && \ 
util-docker -cmd output_app -prefix /opt/myapp -apppath /usr/local/sbin/nginx && \ 
cp -p /usr/local/conf/mime.types /opt/myapp/mime.types 
FROM ubuntu:22.04
COPY --from=builder /opt/myapp /opt/myapp
ENV DEBIAN_FRONTEND=noninteractive 

RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse" > /etc/apt/sources.list && \
echo "deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse" >> /etc/apt/sources.list && \
apt-get update -y  && \
apt-get install -y tzdata  && \
echo "Asia/Shanghai" > /etc/timezone  && \
dpkg-reconfigure -f noninteractive tzdata  && \
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime  && \
apt-get install -y python3-pip  && \
pip install certbot-dnspod && \
apt-get install -y git  && \
mkdir -p /usr/local/conf && cp -p /opt/myapp/mime.types  /usr/local/conf/mime.types && \
git clone -b main https://gitcode.com/hq_make/util-docker.git /tmp/main &&\
cd /tmp/main/shell && chmod +x *.sh && \ 
./install.sh && cd / && \
util-docker -cmd input_app -prefix /opt/myapp && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /var/lib/apt/archives/* /tmp/* 
EXPOSE 80 443 
ENTRYPOINT ["/bin/bash", "-c"] 
CMD ["/usr/local/bin/start"] 
